package executor;

import java.util.HashMap;

/**
 * singelton that hash a hush with all the Executor
 * 
 * @author Vladimir Sarkisyan & Erez Levy
 */
public class ExecutorsHash {
	private HashMap<String, Executor> hashMap;
	
	//create a singelton - This is a global variable 
	public static final ExecutorsHash Instance = new ExecutorsHash();
	
	private ExecutorsHash(){
		hashMap = new HashMap<String, Executor>();
		
		//put Executors in the hash
		hashMap.put("TagFileByUserTag", new TagFileByUserTag());
		hashMap.put("RenameFileInDB", new RenameFileInDB());
		hashMap.put("DeleteFileInDB", new DeleteFileInDB());
		hashMap.put("CreateFileInDB", new CreateFileInDB());
		hashMap.put("CreateUserTag", new CreateUserTagExecutor());
		hashMap.put("SearchUserTag", new SearchUserTagExecutor());	
		hashMap.put("SearchStrategyTag", new SearchStrategyTagExecutor());

		hashMap.put("Exit", new ExitExecutor());
	}
	
	public Executor getExecutor(String str){
		
		if (hashMap.containsKey(str)){
			return hashMap.get(str);
		}
		else{
			return null;
		}
	}
}
